{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/index.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/common.css">
    <script type="text/javascript" src="../../static/personal_center/js/index111.js"></script>
    <link rel="stylesheet" href="../../static/personal_center/css/index.css">
{% endblock %}

{% block style %}
    <style>
        .add_class{
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }

        * {
            margin:0;
            padding:0;
        }

        #YB_mulu div{
            font-size:0;
            overflow: hidden;white-space: nowrap;text-overflow:ellipsis;
        }

        .module1:hover {
            background: #DFDFDF;
        }

        .shade {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(36, 36, 36, 0.5);
            display: none;
            z-index: 10000;
        }
        .canhui_tag {
            color: #00a0e9;border-bottom: #00a0e9 solid 1px;
        }
        .canhui {
            width: 100px;height: 40px;display: inline-block;vertical-align: top;text-align: center;cursor: pointer;
        }
        /* 外面盒子样式---自己定义 */
        .page_div{margin:20px 10px 20px 0;color:#666}
        /* 页数按钮样式 */
        .page_div button{display:inline-block;min-width:30px;height:28px;cursor:pointer;color:#666;font-size:13px;line-height:28px;background-color:#f9f9f9;border:1px solid #dce0e0;text-align:center;margin:0 4px;-webkit-appearance: none;-moz-appearance: none;appearance: none;}
        #firstPage,#lastPage,#nextPage,#prePage{width:50px;color:#0073A9;border:1px solid #0073A9}
        #nextPage,#prePage{width:70px}
        .page_div .current{background-color:#0073A9;border-color:#0073A9;color:#FFF}
        /* 页面数量 */
        .totalPages{margin:0 10px}
        .totalPages span,.totalSize span{color:#0073A9;margin:0 5px}
        /*button禁用*/
        .page_div button:disabled{opacity:.5;cursor:no-drop}

        #yiti_list th {
            height: 35px;border: #cfcfcf solid 0.5px;text-align: center;border-top: none;line-height: 35px;
        }
        #liebiao_body td{
            height: 35px;border: #cfcfcf solid 0.5px;text-align: center;border-top: none;line-height: 35px;
        }

        .module1 {
            width: 100%;
            height: 40px;
            line-height: 40px;
        }
        .button_for_control {
            width: 90px;
            height: 30px;
            border: 1px solid #99D3F5;
            background: #D0EEFF;
            border-radius: 4px;
            letter-spacing: 0;
            line-height: 30px;
            color: #089bab;
            margin: 5px 0;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .switch-div {
            width: 100px;height: 40px;display: inline-block;vertical-align: top;cursor: pointer;
        }
        .switch-active {
            border-bottom: #00a0e9;color: #00a0e9;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div id="new_models1" class="shade">
        <div id="new_models" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 500px;height: 300px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box" style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 50px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 50%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 16px;">
                        <h6 id="modal-title" class="modal-title" style="color: #727E8C;">
                            议题投票
                        </h6>
                    </div>
                    <span onclick="close_models()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 200px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 100%;margin-top: 10px;margin-left: 15px;">
                        <input type="radio" name="vote" value="agree" checked> 同意
                        <input type="radio" name="vote" value="opposition" style="margin-left: 15px;"> 反对
                        <input type="radio" name="vote" value="waiver" style="margin-left: 15px;"> 弃权
                    </div>

                    <div style="margin-top: 3%;">
                        <textarea name="" id="vote_node" cols="60" rows="5" style="width: 96%;margin-left: 2%;border: #cfcfcf solid 1px;outline: none;"></textarea>
                    </div>
                </div>
                <div style="width: 100%;height: 50px;text-align: right;padding-right: 2%;">
                    <button id="summit_but" style="width: 70px;height: 30px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: #1E90FF;color: white;line-height: 28px;">
                        投票
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="new_models2" class="shade">
        <div id="new_models3" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 500px;height: 300px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box2" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 40px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 50%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 16px;">
                        <h6 id="modal-title" class="modal-title" style="color: #727E8C;">
                            投票汇总
                        </h6>
                    </div>
                    <span onclick="close_models1()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 260px;width: 100%;border-bottom: #dfdfdf solid 1px;" id="main">

                </div>

            </div>
        </div>
    </div>

    <div id="new_models5" class="shade">
        <div id="new_models4" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 700px;height: 550px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box3" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 40px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 80%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 16px;">
                        <div id="switch-sing" class="switch-div switch-active" onclick="SwitchContent('singDetail')">签到详情</div>
                        <div id="switch-leave" class="switch-div" onclick="SwitchContent('leaveDetail')">请假详情</div>
                    </div>
                    <span onclick="close_models3()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="width: 100%;height: 92.5%;">
                    <div id="singDetail" style="width: 100%;height: 100%;overflow: auto;">
                        <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">签到人</div>
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">签到时间</div>
                        </div>
                        <div id="bbbbb" style="width: 100%;">

                        </div>
{#                        {% for sing in sing_obj %}#}
{#                            <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">#}
{#                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">#}
{#                                    {{ sing.leaders.real_name }}</div>#}
{#                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">{{ sing.create_time|date:'Y-m-d H:i' }}</div>#}
{#                            </div>#}
{#                        {% endfor %}#}
                    </div>

                    <div id="leaveDetail" style="width: 100%;height: 100%;overflow: auto;display: none;">
                        <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">请假人</div>
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">请假时间</div>
                        </div>
                        <div id="aaaaa" style="width: 100%;">

                        </div>
{#                        {% for leave in leave_obj %}#}
{#                            <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">#}
{#                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">#}
{#                                    {{ leave.leaders.real_name }}</div>#}
{#                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">{{ leave.create_time|date:'Y-m-d H:i' }}</div>#}
{#                            </div>#}
{#                        {% endfor %}#}
                    </div>
                </div>
            </div>
        </div>
    </div>

    
    <div id="new_models7" class="shade" style="z-index: 10110;">
        <div id="new_models6" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 500px;height: 250px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box6" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 40px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 50%;margin-left: 1%;display: inline-block;font-size: 16px;height: 40px;">
                        离会原因
                    </div>
                    <span onclick="close_models6()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 170px;width: 100%;border-bottom: #dfdfdf solid 1px;overflow: auto;">
                    <div style="width: 100%;height: 160px;">
                        <div style="width: 100%;height: 160px;">
                            <textarea name="" id="meeting_reason1" style="width: 100%;height: 160px;border: none;outline: #cfcfcf;"></textarea>
                        </div>
                    </div>
                </div>
                <div style="width: 100%;height: 40px;line-height: 40px;text-align: right;padding-right: 2%;">
                    <button id="lihui_commit" style="width: 70px;height: 25px;margin-top: 5px;line-height: 20px;border-radius: 3px;border: #00a0e9 solid 1px;background: #00a0e9;color: white;">提 交</button>
                </div>
            </div>
        </div>
    </div>


    <div style="width: 100%;height: 40px;border-bottom: #dfdfdf solid 1px;text-align: center;line-height: 40px;">
        <h4 style="line-height: 40px;width: 80%;display: inline-block;letter-spacing: 3px;font-family: 'sans-serif'"><strong id="topic_name"></strong></h4>
        {% if StafFlag == 1 %}
            <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
                <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                        style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                    操作
                </button>
            </div>
        {% endif %}

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button id="attendee" onclick="model_line()" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #0d8ddb;color: white;display: none;">开始会议</button>
            <button id="end_meet" onclick="EndMeeting('1')" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #ff2222;color: white;display: none;">结束会议</button>
            <button id="withdraw_meet" onclick="EndMeeting('2')" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #4876FF;color: white;display: none;">会议撤回</button>
            <button id="check_details" onclick="SignDetail()" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #00A680;color: white;display: none;">签到详情</button>
            <button id="sing_code" onclick="open_check_in_code()" class="button_for_control" style="border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;display: none;">
                签到码
            </button>
        </div>
    </div>

    <div id="my_application" style="width: 100%;height: 95%;overflow: auto;background-color: white;letter-spacing: 0;">
        <div class="right-box" style="width: 100%;height: 100%;margin-top: 0;">
            <div style="height: 94%;width: 100%;overflow: auto;border-bottom: #cccccc solid 1px;background-color: white;">
                <div id="container" style="width: 100%;font-size: 0;">
                    <div style="width: 100%;height: 40px;">
                        {% if types == 'yb' %}
                            <div style="width: 3%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;"></div>
                            <div style="width: 4%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">序号</div>
                            <div style="width: 51%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">议题名称</div>
                            <div style="width: 18%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交科室</div>
                            <div style="width: 14%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交人</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">会议结果</div>
                        {% else %}
                            <div style="width: 3%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;"></div>
                            <div style="width: 4%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">序号</div>
                            <div style="width: 46%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">议题名称</div>
                            <div style="width: 14%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交科室</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交人</div>
                            <div style="width: 13%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">经过办公会</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">会议结果</div>
                        {% endif %}
                    </div>

                    <div id="liebiao_body" style="width: 100%;">

                    </div>
                </div>
            </div>
            <div id="page" class="page_div"></div>
        </div>
    </div>

    <div id="sign-in-model" class="shade1">
        <div id="sign-in-model" style="width: 70%;height: 700px;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div style="width: 100%;height: 40px;font-size: 14px;">
                <div style="width: 100%;height: 40px;letter-spacing: 2px;">
                    <div onclick="close_sign_in()" style="width: 50px;height: 50px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <img src="../../static/personal_center/img/删除.png" alt="" style="width: 50px;height: 50px;">
                    </div>
                </div>
            </div>
            <div style="height: 95%;width: 100%;position: relative;">
                <div style="width: 700px;height: 700px;padding: 50px;position:absolute; top:0; right:0; bottom:0; left:0; margin:auto;background: white;">
                    <div id="output" style="width: 600px;height: 600px;"></div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}


{% block script %}
    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../../static/drag_sort/Sortable.min.js"></script>
    <script type="text/javascript" src="../../static/drag_sort/moduleSet.min.js"></script>
    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../../static/administrative/js/layer.js"></script>
    <script src="../../static/personal_center/js/echarts.js"></script>
    <script type="text/javascript" src="../../static/model_file/js/pageMe.js"></script>
    <script type="text/javascript" src="../../static/personal_center/js/jquery.qrcode.min.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "inline-block";
            document.getElementById("personage").className = "add-nav-active";
            chose_meeting('{{ types }}', 1, 20)
        };

        var mettinig_types = "{{ types | safe }}";

        var StafFlag = '{{ StafFlag | safe }}';

        // 排序
        var container = document.getElementById("liebiao_body");
        var sort = Sortable.create(container, {
            animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
            handle: ".module1", // Restricts sort start click/touch to the specified element
            draggable: ".module1", // Specifies which items inside the element should be sortable
            onUpdate: function (evt/**Event*/) {
                var page_number = '';
                var button_list = document.getElementsByTagName('button')
                var PageNumber = document.getElementById("PageNumber").value;
                for (var ttt=0; ttt<button_list.length; ttt++) {
                    if (button_list[ttt].className === 'current') {
                        page_number = button_list[ttt].innerText;
                    }
                }
                var numbers = (parseInt(page_number)-1)*20;
                var item = evt.item; // the current dragged HTMLElement
                var YbSerialList = document.getElementsByClassName("YbSerial");
                for (var yb_number=0; yb_number<YbSerialList.length; yb_number++) {
                    YbSerialList[yb_number].innerHTML = yb_number + 1 + numbers
                }
                var yiti_topic_name_list = document.getElementsByClassName("yiti-topic-name");
                var id_list = [];
                for (var yiti=0; yiti<yiti_topic_name_list.length; yiti++) {
                    id_list.push(yiti_topic_name_list[yiti].id)
                }
                if (StafFlag === '1') {
                    change_meeting_order(id_list, page_number, PageNumber);
                 }
            }
        });

        function change_meeting_order(id_list, page_number, PageNumber) {
            if (confirm("确定要改变投票顺序吗?")) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/announcements/ChangeMeetingOrder");
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
                xhr.send("id_list="+JSON.stringify(id_list)+"&page_number="+String(page_number)+"&PageNumber="+String(PageNumber));
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            var JsonDate = JSON.parse(xhr.responseText);
                            if (JsonDate['code'] === 200){
                                alert("为避免更改顺序无法进入详情页，请提醒参会人员刷新界面！");
                                var PageNumber = document.getElementById("PageNumber").value;
                                chose_meeting(mettinig_types, 1, PageNumber)
                            }
                        }
                    }
                };
            }
        }

        function chose_meeting(types, cPage, PageNumber) {
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/TopicDeliberation.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("types="+String(types)+"&cPage="+String(cPage)+"&pSize="+String(PageNumber));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            document.getElementById("topic_name").innerText=JsonDate["topic_title"];
                            if (JsonDate["flag"]){
                                document.getElementById("attendee").style.display="inline-block";
                                document.getElementById("end_meet").style.display="inline-block";
                                document.getElementById("withdraw_meet").style.display="inline-block";
                                document.getElementById("check_details").style.display="inline-block";
                                document.getElementById("sing_code").style.display="inline-block";
                            }
                            create_table(JsonDate["data"]);
                            create_page(types, cPage, JsonDate['totals'], PageNumber);
                        }
                    }
                }
            };
        }

        function ChangePageNumber() {
            document.getElementById("loading").style.display = "inline-block";
            var PageNumber = document.getElementById("PageNumber").value;
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/TopicDeliberation.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("types="+String(mettinig_types)+"&cPage=1&pSize="+String(PageNumber));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            document.getElementById("topic_name").innerText=JsonDate["topic_title"];
                            if (JsonDate["flag"]){
                                document.getElementById("attendee").style.display="inline-block";
                                document.getElementById("end_meet").style.display="inline-block";
                                document.getElementById("withdraw_meet").style.display="inline-block";
                            }

                            create_table(JsonDate["data"]);
                            create_page(mettinig_types, 1, JsonDate['totals'], PageNumber);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
            };
        }

        function create_table(Json_data) {
            var types = '{{ types | safe }}';
            document.getElementById('liebiao_body').innerHTML = '';
            for (var i=0; i<Json_data.length; i++) {
                if (types === 'yb') {
                    var html_str = `
                        <div class="module1" style="width: 100%;">
                            <div style="width: 3%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;cursor: move;">
                                <i style="font-size: 14px;" class="gm-icon gm-icon-move"></i>
                            </div>
                            <div class="YbSerial" style="width: 4%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+Json_data[i]['Serial_Number']+`</div>
                            <div class="yiti-topic-name" id="`+Json_data[i]['id']+`" style="width: 51%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: left;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 1%;">`+Json_data[i]['topic_name']+`</div>
                            <div style="width: 18%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 3px;" title="`+Json_data[i]['company']+`">`+Json_data[i]['company']+`</div>
                            <div style="width: 14%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;" title="`+Json_data[i]['submitter']+`">`+Json_data[i]['submitter']+`</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+Json_data[i]['meet_result']+`</div>
                        </div>`
                }else {
                    html_str = `
                        <div class="module1" style="width: 100%;">
                            <div style="width: 3%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;cursor: move;">
                                <i style="font-size: 14px;" class="gm-icon gm-icon-move"></i>
                            </div>
                            <div class="YbSerial" style="width: 4%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+Json_data[i]['Serial_Number']+`</div>
                            <div class="yiti-topic-name" id="`+Json_data[i]['id']+`" style="width: 46%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: left;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 1%;">`+Json_data[i]['topic_name']+`</div>
                            <div style="width: 14%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 3px;" title="`+Json_data[i]['company']+`">`+Json_data[i]['company']+`</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;" title="`+Json_data[i]['submitter']+`">`+Json_data[i]['submitter']+`</div>
                            <div style="width: 13%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;" title="`+Json_data[i]['is_yb']+`">`+Json_data[i]['is_yb']+`</div>
                            <div style="width: 10%;height: 100%;line-height: 40px;border: #0b0b0b solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+Json_data[i]['meet_result']+`</div>
                        </div>
                    `
                }
                $("#liebiao_body").append(html_str);
            }
        }

        function create_page(types, cPage, totals, PageNumber) {
            $("#page").paging({
                pageNum: cPage, // 当前页面
                totalNum: Math.ceil(totals/parseInt(PageNumber)), // 总页码
                totalList: totals, // 记录总数量
                PageNumber: PageNumber,     // 每页的数量
                callback: function (num) { //回调函数
                    chose_meeting(types, num, PageNumber);
                }
            });
        }

        let title = document.querySelector("#box");
        let addForm = document.querySelector("#new_models");

        title.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm.offsetLeft;
            let y = e.pageY - addForm.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm.style.left = e.pageX - x + 'px';
                addForm.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let title1 = document.querySelector("#box2");
        let addForm1 = document.querySelector("#new_models3");

        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm1.offsetLeft;
            let y = e.pageY - addForm1.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm1.style.left = e.pageX - x + 'px';
                addForm1.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let title3 = document.querySelector("#box3");
        let addForm3 = document.querySelector("#new_models4");

        title3.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm3.offsetLeft;
            let y = e.pageY - addForm3.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm3.style.left = e.pageX - x + 'px';
                addForm3.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let title6 = document.querySelector("#box6");
        let addForm6 = document.querySelector("#new_models6");

        title6.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm6.offsetLeft;
            let y = e.pageY - addForm6.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm6.style.left = e.pageX - x + 'px';
                addForm6.style.top = e.pageY - y + 'px';
            }
            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function close_models() {
            document.getElementById("new_models1").style.display = "none";
        }

        function close_models1() {
            document.getElementById("new_models2").style.display = "none";
        }

        function close_models3() {
            document.getElementById("new_models5").style.display = "none";
        }

        function close_models6() {
            document.getElementById("new_models7").style.display = "none";
        }

        function model_line6(user_job_number, types) {
            document.getElementById("new_models7").style.display = "table-row";
            document.getElementById("lihui_commit").setAttribute('onclick', 'remove_leader("'+user_job_number+'", "'+types+'")');
        }

        function model_line() {
            var remind = confirm("是否确认开始会议？")
            if (remind) {
                meeting_leader();
            }
        }

        function SignDetail() {
            document.getElementById("new_models5").style.display = "table-row";
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/new-flow-logic/SignDetail");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("meet_number={{ meet_number }}&topic_year={{ topic_year }}&topic_year={{ topic_year }}&topic_type={{ types }}");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            create_table_1(JsonDate["leave_dict"], JsonDate["sing_dict"])
                        }else {
                            alert(JsonDate['message']);
                        }
                    }
                }
            };
        }

        function create_table_1(json_date, sing_dict) {
            document.getElementById("aaaaa").innerHTML = "";
            document.getElementById("bbbbb").innerHTML = "";
            for (var a=0; a<json_date.length; a++) {
                var html_str = `<div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">
                                    `+json_date[a]["real_name"]+`</div>
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">`+json_date[a]["time"]+`</div>
                            </div>`
                $("#aaaaa").append(html_str)
            }

            for (var b=0; b<sing_dict.length; b++) {
                var html_str1 = `<div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">
                                    `+sing_dict[b]["real_name"]+`</div>
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">`+sing_dict[b]["time"]+`</div>
                            </div>`
                $("#bbbbb").append(html_str1)
            }
        }
        
        function meeting_leader() {
            var topic_name = document.getElementById("topic_name").innerText;
            {#var meetornot_list = document.getElementsByClassName("meetornot");              // 是否参会#}
            {#var voteornot_list = document.getElementsByClassName('voteornot');              // 是否投票#}
            {#var hostornot_list = document.getElementsByClassName('hostornot');              // 主持人#}
            {#var leader_dict = {}#}
            {#var MeetFlag = false#}
            {#var determine = true#}
            {#for (var i=0; i<meetornot_list.length; i++){#}
            {#    if (meetornot_list[i].checked){#}
            {#        var meetornot = true#}
            {#    }else {#}
            {#        meetornot = false#}
            {#        MeetFlag = true#}
            {#    }#}
            {##}
            {#    if (voteornot_list[i].checked) {#}
            {#        var voteornot = true#}
            {#    }else {#}
            {#        voteornot = false#}
            {#    }#}
            {##}
            {#    if (hostornot_list[i].checked) {#}
            {#        var hostornot = true#}
            {#        determine = false#}
            {#    }else {#}
            {#        hostornot = false#}
            {#    }#}
            {##}
            {#    leader_dict[meetornot_list[i].value] = {"meetornot": meetornot, "voteornot": voteornot, "hostornot": hostornot}#}
            {# }#}

            {#if (determine) {#}
            {#    alert("请选择会议主持人！")#}
            {#    return false#}
            {# }#}

            {#var meeting_reason = '';#}
            {#if (MeetFlag) {#}
            {#    meeting_reason = document.getElementById("meeting_reason").value;#}
            {# }#}
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/system-setup/start_meeting");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("types={{ types }}&topic_name="+String(topic_name));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            alert("操作成功！");
                            window.location.reload();
                        }else {
                            alert(JsonDate['message']);
                        }
                    }
                }
            };
        }

        function AllParticipants(eve) {
            var meetornot_list = document.getElementsByClassName("meetornot");
            if (eve.checked) {
                for (var i=0; i<meetornot_list.length; i++) {
                    meetornot_list[i].checked=true
                }
            }else {
                for (var j=0; j<meetornot_list.length; j++) {
                    meetornot_list[j].checked=false
                }
            }
        }

        function AllVote(eve) {
            var voteornot_list = document.getElementsByClassName("voteornot");
            if (eve.checked) {
                for (var i=0; i<voteornot_list.length; i++) {
                    voteornot_list[i].checked=true
                }
            }else {
                for (var j=0; j<voteornot_list.length; j++) {
                    voteornot_list[j].checked=false
                }
            }
        }

        function remove_leader(leaders, types) {
            var meeting_reason1 = document.getElementById("meeting_reason1").value;
            var topic_name = document.getElementById("topic_name").innerText;
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/remove_leader");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("topic_name="+String(topic_name)+"&leaders="+String(leaders)+"&types="+String(types)+"&meeting_reason1="+meeting_reason1);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            window.location.reload()
                        }
                    }
                }
             };
        }

        function EndMeeting(operate_type) {
            if (operate_type === '1') {
                var Prompt = '确定结束会议吗?'
            }else {
                Prompt = '撤回会议会将本次议题退回至待上会状态！确认撤回会议吗？'
            }
            var a = confirm(Prompt)
            if (a) {
                var topic_name = document.getElementById("topic_name").innerText;
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/system-setup/start_meeting");
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
                xhr.send("types={{ types }}&topic_name="+String(topic_name)+"&end_meeting=1111&operate_type="+operate_type);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            if (JsonDate['code'] === 200){
                                if (operate_type === '2') {
                                    alert("撤回成功！")
                                    window.location.href = "/personal-center/sponsor.html"
                                }
                                document.getElementById("new_models5").style.display = "none";
                                window.location.reload();
                            }
                        }
                    }
                 };
            }
        }

        function change_canhui(ele_id) {
           if (ele_id === "canhui_div") {
               document.getElementById('canhui').className='canhui canhui_tag';
               document.getElementById('weicanhui').className='canhui';
               document.getElementById('canhui_div').style.display="block";
               document.getElementById('weicanhui_div').style.display="none";
           }else {
               document.getElementById('weicanhui').className='canhui canhui_tag';
               document.getElementById('canhui').className='canhui';
               document.getElementById('canhui_div').style.display="none";
               document.getElementById('weicanhui_div').style.display="block";
           }
        }

        function HostMan(objs) {
            var hostornot_list = document.getElementsByClassName("hostornot");
            for (var i=0; i<hostornot_list.length; i++) {
                hostornot_list[i].checked = false;
            }
            objs.checked = true;
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function open_check_in_code() {
            var topic_name = document.getElementById("topic_name").innerText;
            document.getElementById("sign-in-model").style.display="table-row";
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            var local_host = window.location.host;
            jQuery('#output').qrcode("https://oaapi.hbjsxrmyy.com/new-flow-logic/topic_scan_code_confirmation?flow_id=&timestamp=" + String(timestamp) + "&type={{ types }}&meet_number={{ meet_number }}&topic_year={{ topic_year }}");
            interval = setInterval(create_sing_code,13000);
        }

        function create_sing_code() {
            var topic_name = document.getElementById("topic_name").innerText;
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            var local_host = window.location.host;
            jQuery('#output').qrcode("https://oaapi.hbjsxrmyy.com/new-flow-logic/topic_scan_code_confirmation?flow_id=&timestamp=" + String(timestamp) + "&type={{ types }}&meet_number={{ meet_number }}&topic_year={{ topic_year }}");
        }

        function close_sign_in() {
            document.getElementById("sign-in-model").style.display="none";
            clearInterval(interval)
        }

        function SwitchContent(switch_tag) {
            if (switch_tag === 'singDetail') {
                document.getElementById('singDetail').style.display = "block";
                document.getElementById('leaveDetail').style.display = "none";
                document.getElementById("switch-sing").className = "switch-div switch-active";
                document.getElementById("switch-leave").className = "switch-div";
            }else {
                document.getElementById('leaveDetail').style.display = "block";
                document.getElementById('singDetail').style.display = "none";
                document.getElementById("switch-leave").className = "switch-div switch-active";
                document.getElementById("switch-sing").className = "switch-div";
            }
        }
    </script>
{% endblock %}
